#include <iostream>

using namespace std;

int main()
{
    int n, m;
    double max, min;
    double Max = 0;
    double a, sum;
    cin >> n >> m;
    int *p = new int[m];
    while (n--)
    {
        sum = 0;
        a = 0;
        for (int i = 0; i < m; i++)
        {
            cin >> p[i];
            sum += p[i];
            if (i == 0)
            {
                max = p[i];
                min = max;
            }
            if (p[i] > max)
            {
                max = p[i];
            }
            if (p[i] < min)
            {
                min = p[i];
            }
        }
        sum = sum - min - max;
        // cout << sum << endl;
        if ((sum / (m - 2) * 1.0) > Max)
        {
            Max = sum / (m - 2) * 1.0;
        }
    }
    printf("%.2f", Max);
    return 0;
}